<?php
$version = Zend_Registry::get('version');
$tab_base_link = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
$this->proForm->setEditor($this->serverUrl().$this->baseUrl());
$this->proForm->getEditor();
echo $this->headScript()->setFile($this->baseUrl().'/js/jquery/tree/javascripts/jquery.treeTable.js');	
echo $this->headScript()->setFile($this->baseUrl().'/js/jquery/jquery.scrollTo-min.js');

$global_conf = Zend_Registry::get('global_conf');
$currency = new Zend_Currency($global_conf['default_locale']);

$auth = Zend_Auth::getInstance ();	
$u_role_id = ($auth->hasIdentity ()) ? $auth->getIdentity()->role_id : '' ;
$u_user_id = ($auth->hasIdentity ()) ? $auth->getIdentity()->user_id : '' ;

$frontController = Zend_Controller_Front::getInstance();
$param_group_id = $frontController->getRequest()->getParam('group_id');

$original_tab_counter = 5;
?>
<script type="text/javascript">
(function( $ ) {
		$.widget( "ui.combobox", {
			_create: function() {
				var self = this,
					select = this.element.hide(),
					selected = select.children( ":selected" ),
					value = selected.val() ? selected.text() : "";
				var input = $( "<input>" )
					.insertAfter( select )
					.val( value )
					.autocomplete({
						delay: 0,
						minLength: 0,
						source: function( request, response ) {
							var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
							response( select.children( "option" ).map(function() {
								var text = $( this ).text();
								if ( this.value && ( !request.term || matcher.test(text) ) )
									return {
										label: text.replace(
											new RegExp(
												"(?![^&;]+;)(?!<[^<>]*)(" +
												$.ui.autocomplete.escapeRegex(request.term) +
												")(?![^<>]*>)(?![^&;]+;)", "gi"
											), "<strong>$1</strong>" ),
										value: text,
										option: this
									};
							}) );
						},
						select: function( event, ui ) {
							ui.item.option.selected = true;
							self._trigger( "selected", event, {
								item: ui.item.option
							});
						},
						change: function( event, ui ) {
							if ( !ui.item ) {
								var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
									valid = false;
								select.children( "option" ).each(function() {
									if ( this.value.match( matcher ) ) {
										this.selected = valid = true;
										return false;
									}
								});
								if ( !valid ) {
									// remove invalid value, as it didn't match anything
									
									select.append('<option value="'+$( this ).val()+'">'+$( this ).val()+'</option>');
									select.val( $( this ).val() );
									return false;
								}
							}
						}
					})
					.addClass( "ui-widget ui-widget-content ui-corner-left" );

				input.data( "autocomplete" )._renderItem = function( ul, item ) {
					return $( "<li></li>" )
						.data( "item.autocomplete", item )
						.append( "<a>" + item.label + "</a>" )
						.appendTo( ul );
				};

				$( "<span>&nbsp;</span>" )
					.attr( "tabIndex", -1 )
					.attr( "title", "Show All Items" )
					.insertAfter( input )
					.button({
						icons: {
							primary: "ui-icon-triangle-1-s"
						},
						text: false
					})
					.removeClass( "ui-corner-all" )
					.addClass( "ui-corner-right ui-button-icon" )
					.click(function() {
						// close if already visible
						if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
							input.autocomplete( "close" );
							return;
						}

						// pass empty string as value to search for, displaying all results
						input.autocomplete( "search", "" );
						input.focus();
					});
			}
		});
	})( jQuery );

	$(function() {
		$( "#property_owner" ).combobox();		
	})


$(function() {
		$("#tabs").tabs().find(".ui-tabs-nav").sortable({axis:'xy'});
	});
$(document).ready(function() {	
	floatingbar('#floatingbar',"#button_top_bar",null);
	/**********Scrolling Tools Start****************/
	$.easing.elasout = function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	};
	
	$('#toc a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 1500, { easing:'swing' });
		$(this.hash).find('span.message').text( this.title );
		return false;
	});
	
	$('span.top-go a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 1500, { easing:'swing' });		
		return false;
	});
	
	/**********Scrolling Tools END****************/
	
	function stripslashes(str) 
	{
		str=str.replace(/\\'/g,'\'');
		str=str.replace(/\\"/g,'"');
		str=str.replace(/\\0/g,'\0');
		str=str.replace(/\\\\/g,'\\');
		return str;
	}
	
	$('select.country_id').change(function() {	
		if($('select.country_id option:selected').val() == '0' || $('select.country_id option:selected').val() =='')
		{
			$('select.area_id').html('<option value=""><?php echo $this->translator->translator("property_select_area"); ?></option>');	
			$('select.state_id').html('<option value=""><?php echo $this->translator->translator("property_select_state"); ?></option>');
		}
		else
		{	
			$.ajax({
				  url: "<?php echo $this->url( array('module' =>'Property','controller' => 'backendpro', 'action'     => 'states' ), 'adminrout',    true) ?>",
				  type: 'POST',
				  data: { id: $('select.country_id option:selected').val() },
				  beforeSend: function(){						
							$('select.state_id').html('<option value=""><?php echo $this->translator->translator("common_loading_language"); ?></option>');
							$('select.area_id').html('<option value=""><?php echo $this->translator->translator("property_select_area"); ?></option>');			
							$('#state_id_loader').html('<img src="application/modules/Administrator/layouts/scripts/images/loader/ajax_loader.gif" border="0" height="16" />');	
						 },
				  success: function(response){
					//alert(response);
					var json_arr = eval("("+response+")");
					var option = '<option value=""><?php echo $this->translator->translator("property_select_state"); ?></option>';				
					if(json_arr.status == 'ok')
					{
						for(var i = 0;i<json_arr.states.length;i++)
						{
							option += '<option value="'+json_arr.states[i].state_id+'" >'+stripslashes(json_arr.states[i].state_name)+'</option>';
						}
						$('select.state_id').html(option);
					}
					else
					{
						$('select.state_id').html('<option value="">'+json_arr.msg+'</option>');
					}
					$('#state_id_loader').html('');
					$('#state_id_err').html('');
				  }
			});
		}
	});
	
	$('select.state_id').change(function() {		
				
		if($('select.state_id option:selected').val() == 0 || $('select.state_id option:selected').val() == '')
		{
			$('select.area_id').html('<option value=""><?php echo $this->translator->translator("property_select_area"); ?></option>');
		}
		else
		{
			$.ajax({
				  url: "<?php echo $this->url( array('module' => 'Property', 'controller' => 'backendpro', 'action'     => 'areas' ), 'adminrout',    true) ?>",
				  type: 'POST',
				  data: { id: $('select.state_id option:selected').val() },
				  beforeSend: function(){						
						$('select.area_id').html('<option value=""><?php echo $this->translator->translator("common_loading_language"); ?></option>');
						$('#area_id_loader').html('<img src="application/modules/Administrator/layouts/scripts/images/loader/ajax_loader.gif" border="0" height="16" />');	
						},
				  success: function(response){
					//alert(response);
					var json_arr = eval("("+response+")");
					var option = '<option value=""><?php echo $this->translator->translator("property_select_area"); ?></option>';				
					if(json_arr.status == 'ok')
					{
						for(var i = 0;i<json_arr.cities.length;i++)
						{
							option += '<option value="'+json_arr.cities[i].city_id+'" >'+stripslashes(json_arr.cities[i].city)+'</option>';
						}
						$('select.area_id').html(option);
					}
					else
					{
						$('select.area_id').html('<option value="">'+json_arr.msg+'</option>');
					}
					$('#area_id_loader').html('');
					$('#area_id_err').html('');
				  }
			});
		}
	});		
	
	
	$("#upload-form").dialog({
		autoOpen: false,
		width: 860,
		height: 610,
		show: 'fade',			
		modal: true
	});	

	$('a.upload_btn').click(function() {
		var self = this;
		var src = $("#i-upload-form").attr("src");
		$("#i-upload-form").attr("src", '');
		
		var group_id = $("#group_id").val();
		$('input[name="primary_id_field_value"]').val(group_id);
		
		var rel = $(self).attr('rel');		
		var file_suffix = rel;	
		var file_content = $('#'+file_suffix).val();
		
		$('input[name="file_path_field"]').val('file_path_'+rel);
		$('input[name="file_content"]').val(file_content);		
		$('input[name="primary_file_field"]').val(file_suffix);		
		
		if(group_id != null && group_id != "")
		{
			$("#popupForm").attr("action", "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action' => 'manager' ), 'adminrout',    true) ?>");			
			$('#upload-form').dialog('open');
			$('#popupForm').submit();
		}
		else
		{
			msg = "<?php echo $this->translator->translator('group_id_selected_err'); ?>";
			openMsgDialog(msg);
		}
	});	
	
	$('a.select_file_btn').click(function() {		 
		
			var currentIFrame = $('#i-upload-form');
			var selected_files = currentIFrame.contents().find("input[name='selected_files']").val();
			var primary_file_field = currentIFrame.contents().find("input[name='primary_file_field']").val();
			var file_path	=	currentIFrame.contents().find("input[name='file_path']").val();
			var selected_files_arr = (selected_files != '') ? selected_files.split(',') : new Array();	
			if(selected_files_arr.length == '0')
			{
				var msg = "<?php echo $this->translator->translator('insert_selected_file_err'); ?>";				
				openMsgDialog(msg);
			}
			else
			{
				var img_code = '';
				var file_name = '';
				for(var i=0;i < selected_files_arr.length;i++)
				{
					var ext = getFileExtension(selected_files_arr[i]);
					var img_path = '';
					switch(ext)
					{
						case 'flv':
						case 'swf':
						case 'FLV':
						case 'SWF':
							img_path = 'application/modules/Administrator/layouts/scripts/images/common/flash.png';
							break;
						case 'mp3':
						case 'MP3':
							img_path = 'application/modules/Administrator/layouts/scripts/images/common/mp3.png';
							break;
						case 'avi':
						case 'wmv':
						case 'wma':
						case 'WMA':
						case 'AVI':
						case 'WMV':
							img_path = 'application/modules/Administrator/layouts/scripts/images/common/avi_thumb.png';
							break;
						case 'pdf':
						case 'doc':
						case 'docx':
						case 'xls':
						case 'xlsx':
						case 'ppt':
						case 'pptx':
						case 'PDF':
						case 'DOC':
						case 'DOCX':
						case 'XLS':
						case 'XLSX':
						case 'PPT':
						case 'PPTX':
							img_path = 'application/modules/Administrator/layouts/scripts/images/common/'+ext.toLowerCase()+'.png';
							break;
						default:
							img_path = file_path +'/'+ selected_files_arr[i]; 
							break;
					}
					
					var checked = (i == 0)? ' checked="checked" ' : '';
					var img_type = 	(i == 0) ? "<span class='main'><?php echo $this->translator->translator('gallery_img_main', '', 'Gallery'); ?></span>" : "<span class='related'><?php echo $this->translator->translator('gallery_img_related', '', 'Gallery'); ?></span>";
					var primary_file_field_radio =	(primary_file_field == 'property_image') ? 'property_primary_image'	: 'feature_primary_floor_image';						
					var primary =  '<input class="radio_style" type="radio" name="'+primary_file_field_radio+'" id="'+primary_file_field_radio+'" '+checked+' value="'+selected_files_arr[i]+'" title="<?php echo $this->translator->translator("property_primary_image"); ?>" />';
					var del_link = '<a href="javascript:void(0)" class="delete_image_lnk" rel="'+selected_files_arr[i]+'"><?php echo html_entity_decode($this->translator->translator("common_delete"), ENT_QUOTES, "UTF-8"); ?></a>'+primary;
					
					img_code += '<div class="upload-img box">'+img_type+'<br /><span><span class="thumb"><img src="'+img_path+'" width="45" height="35" class="bdr" /></span><br /><br />'+del_link+'&nbsp;</span></div>';
					file_name = (i == 0)? selected_files_arr[i] : file_name+','+selected_files_arr[i];					
				}			
				var file_suffix = primary_file_field;		
				$('#selected_file_'+file_suffix).html(img_code);		
				$('#'+file_suffix).val(file_name);		
				$("#i-upload-form").attr("src", ''); 						
				$("#upload-form").dialog('option','hide','explode').dialog('close');				
				deleteFiles("<?php echo $this->translator->translator('gallery_img_main', '', 'Gallery'); ?>", "<?php echo $this->translator->translator('gallery_img_related', '', 'Gallery'); ?>", "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'remove' ), 'adminrout',    true) ?>", "<?php echo $this->translator->translator('common_delete_title'); ?>");	
				imageThumbnil();
			}
		});
	
	$('a.close_dialog_btn').click(function() {	
		$("#i-upload-form").attr("src", "");
		$("#i-upload-form").html('');	 
		$("#upload-form").dialog('option','hide','explode').dialog('close');			
	});
		
	$('a.reset_btn').click(function() {			
		 resetFields();	
		 removeError();	
		 <?php if($auth->getIdentity()->access_file_image_manager != '1'){ ?>
			  uploadSettingsEnd();			
		  <?php } ?>
	});
	
	function resetFields()
	{
		$( "form" )[ 0 ].reset();		
		$('#selected_file_property_image').html('');	
		$('#selected_file_feature_floor_plan_image').html('');					
		$('#categoryTree').html('&nbsp;');		
		$('#property_parent').val('0');
		$('#property_image').val('');
		$('#feature_floor_plan_image').val('');
		$('#dataId').html('<?php echo $this->translator->translator("property_tree_root"); ?> (0)');		
		if(tinyMCE.get('property_desc'))
		{
			tinyMCE.get('property_desc').setContent('');
		}
		if(tinyMCE.get('property_address'))
		{
			tinyMCE.get('property_address').setContent('');
		}
		if(tinyMCE.get('feature_google_map'))
		{
			tinyMCE.get('feature_google_map').setContent('');
		}
		if(tinyMCE.get('feature_additional'))
		{
			tinyMCE.get('feature_additional').setContent('');
		}
		if(tinyMCE.get('brochure_desc'))
		{
			tinyMCE.get('brochure_desc').setContent('');
		}
		if(tinyMCE.get('payment_desc'))
		{
			tinyMCE.get('payment_desc').setContent('');
		}
		$('a.back_btn_link').attr('href','<?php echo $this->url( array("module" => "Property","controller" => "backendpro", "action"  => "list" ,"group_id" => $param_group_id), "adminrout",    true) ?>');
		removeTabs();
	}
	
	function removeError()
	{
		$('#actionMessage').html('');
		$('#feature_amenities_err').html('');
		$('#feature_other_amenities_err').html('');
		
		var filename = '';
		var filevalue = '';		
		$.each($('form').serializeArray(), function(i, field) {	
				if(field.name.match(/\[\]$/))
				{
					var filearr = field.name.split('[]');
					filename = filearr[0];					
				}
				else
				{
					filename 	= 	field.name;
				} 			
				$('#'+filename).removeClass('ui-state-error');
				$('#'+filename+'_err').html('');									
		});				
	}
	
	function addError(key,errMsg)
	{
		var err_id = key+'_err';
		var field_name = key;
		$('#'+field_name).addClass('ui-state-error');
		$('#'+err_id).append(errMsg);
	}
		
	function openLoaderDialog()
	{
		$('#dialog_container').dialog({
					autoOpen: true,
					modal: true,
					show: 'slide',
					resizable: false,				
					open: function(event, ui)
						 {
						 	$("#progressbar").progressbar({
								value:100
				
							});							
						  }
				});
	}
	
	function closeLoaderDialog()
	{
		$('#dialog_container').dialog('option','hide','explode').dialog('close');
	}
	
	function getFormData()
	{
		var fieldObj = {};
		var filename = '';
		var filevalue = '';
		$.each($('form').serializeArray(), function(i, field) {	
			if(field.name.match(/\[\]$/))
			{
				var filearr = field.name.split('[]');
				filename = filearr[0];
				filevalue = $('#'+filename).val();
				if($('input[name="'+field.name+'"]').is(':checkbox'))
				{
					var val_arr = [];
					$('input[name="'+field.name+'"]:checkbox:checked').each(function(i){
					 val_arr[i] = $(this).val();
					});
					filevalue = (val_arr[0] != null) ? val_arr.join(',') : null;					
				}
			}
			else
			{
				filename 	= 	field.name;
				filevalue 	= 	field.value;
			}			
			fieldObj[filename] = (tinyMCE.get(filename)) ? tinyMCE.get(filename).getContent() : filevalue;			
		});
		return fieldObj;
	}
	
	$('a.add_property_btn').click(function() {			
			
		var formData = getFormData();
	
		$.ajax({
			url: "<?php echo $this->url( array('module' => 'Property','controller' => 'backendpro', 'action'     => 'add' ), 'adminrout',    true) ?>",
			  	type: 'POST',
			  	data: formData,
				beforeSend: function(){						
						removeError();
						openLoaderDialog();				
					 },
				success: function(response){
					//alert(response);					
					var json_arr = eval("("+response+")");					
					closeLoaderDialog();					
					if(json_arr.status == 'ok')
					{
						$('#actionMessage').html(succMsgDesign(json_arr.msg));						
						resetFields();							
					}
					else if(json_arr.status == 'errV')
					{
						$('#actionMessage').html(errMsgDesign("<?php echo $this->translator->translator('common_err'); ?>"));
												
						for(var i= 0; i < json_arr.msg.length; i++)
						{
							addError(json_arr.msg[i].key,json_arr.msg[i].value);				
						}
						openFirstErrTab(json_arr.msg, 'tabs', 'tabs-');
					}
					else
					{
						$('#actionMessage').html(errMsgDesign(json_arr.msg));
					}
				},
				error: function(xhr, status, error){
					closeLoaderDialog();
					var msg = "Error! " + xhr.status + " " + error;
					$('#actionMessage').html(errMsgDesign(msg));
				}
		});
	});
	
/***********************************Get Property Group***************************************/
	$('select.property_select_group').change(function() {			
		var group_id = $('#group_id').val();
		removeTabs();
		if(group_id != '')
		{
			$('a.back_btn_link').attr('href','Property/backendpro/list/group_id/'+group_id);
			$.ajax({
				url: "<?php echo $this->url( array('module' => 'Property','controller' => 'backendpro', 'action'     => 'propertygroup' ), 'adminrout',    true) ?>",
			  	type: 'POST',
			  	data: { grp_id: group_id },
				beforeSend: function(){						
						$('#group_id_loader').html('<img src="application/modules/Administrator/layouts/scripts/images/loader/ajax_loader.gif" border="0" height="16" />');			
					 },
				success: function(response){
					//alert(response);
					var json_arr = eval("("+response+")");
					
					if(json_arr.status == 'ok')
					{												
						var tree = '<table class="example" id="dnd-example">'+
										'<tbody ><tr id="node-0">'+
										 '<td>'+
											'<span class="folder"><?php echo $this->translator->translator("property_tree_root"); ?></span>'+
										'</td>'+
									'</tr>';
							tree += json_arr.propertyGroup+'</tbody></table>';
						$('#categoryTree').html(tree);
						categoryTreeGen();
					}
					else
					{
						var tree = '<table class="example" id="dnd-example">'+
										'<tbody ><tr id="node-0">'+
										 '<td>'+
											'<span class="folder"><?php echo $this->translator->translator("property_tree_root"); ?></span>'+
										'</td>'+
									'</tr>';
							tree += '</tbody></table>';
						$('#categoryTree').html(tree);
						categoryTreeGen();						
					}
					dynamicFieldGenrator(json_arr.dynamic_field_arr);
					$('#group_id_err').html('');
					$('#group_id_loader').html('');							
					<?php if($auth->getIdentity()->access_file_image_manager != '1'){ ?>
							uploadSettingsStart(json_arr);
						<?php } ?>
					var business_type = json_arr.businessType_options;
					var option = '<option value=""><?php echo $this->translator->translator("property_select_businessType"); ?></option>';
					if(business_type)
					{							
						for(var i =0;i < business_type.length;i++)
						{
							option += '<option value="'+business_type[i].id+'">'+stripslashes(business_type[i].business_type)+'</option>';
						}						
					}
					$('#property_type').html(option);					
				}
			});
		}
		else
		{
			var tree = '<table class="example" id="dnd-example">'+
										'<tbody ><tr id="node-0">'+
										 '<td>'+
											'<span class="folder"><?php echo $this->translator->translator("property_tree_root"); ?></span>'+
										'</td>'+
									'</tr>';
				tree += '</tbody></table>';
			$('#categoryTree').html(tree);
			categoryTreeGen();
			$('#group_id_err').html('');
			$('#group_id_loader').html('');	
			var option = '<option value=""><?php echo $this->translator->translator("property_select_businessType"); ?></option>';
			$('#property_type').html(option);
			$('a.back_btn_link').attr('href','Property/backendpro/list');
			<?php if($auth->getIdentity()->access_file_image_manager != '1'){ ?>
				uploadSettingsEnd();			
			<?php } ?>
		}		
	});
	
		
	
});


function openMsgDialog(msg)
{
	$('#dialog_msg').html(msg).dialog({
		autoOpen: true,
		modal: true,
		show: 'fade',
		resizable: true,				
		buttons: [{ text: "<?php echo html_entity_decode($this->translator->translator('common_ok'), ENT_QUOTES, 'UTF-8'); ?>", click: function() { $(this).dialog('option', 'hide', 'explode').dialog("close"); } } ],
		open: function(event, ui)
			 {
				setTimeout(function() 
				{									
					if($('#' + event.target.id).dialog('isOpen'))
					{
						$('#' + event.target.id).dialog('option', 'hide', 'fade').dialog('close');										
					}
				}, 10000);
			  }
	});
}
	
/**********************************DYNAMIC FIELD GENERATOR START****************************************************/

function dynamicFieldGenrator(field_obj)
{
	if(field_obj.status == 'ok')
	{		
		var tab_counter =$('#tabs').children('ul:first').children('li').length;
		tab_counter++;	
		var tab_content = '';	
		
		for(var i = 0; i < field_obj.dynamic_fields.length; i++)
		{
			var tab_title = field_obj.dynamic_fields[i].<?php echo Eicra_File_Constants::DYNAMIC_FIELD_GROUP_TITLE; ?>;
			var total_obj = new Array();
			tab_content = '<fieldset class="fieldset">'+															
								'<legend class="legend">'+tab_title+'</legend>'+
								'<span class="top-go right-float"><a href="#topGo"><img src="application/modules/Administrator/layouts/scripts/images/tools/top.png" border="0" alt="<?php echo $this->translator->translator('common_go_top_title'); ?>" title="<?php echo $this->translator->translator('common_go_top_title'); ?>" /></a></span>'+
								'<div class="form">';
			var tb = 0;									
			for(var j = 0; j < field_obj.dynamic_fields[i].<?php echo Eicra_File_Constants::DYNAMIC_FIELD_GROUP_ELEMENTS; ?>.length; j++)
			{
				var element_obj		= field_obj.dynamic_fields[i].<?php echo Eicra_File_Constants::DYNAMIC_FIELD_GROUP_ELEMENTS; ?>[j];
				var element_type 	= element_obj.type;				
				if(element_obj.admin == '1')
				{		
					switch(element_type)
					{
						case 'file':
							var element = element_obj.element; 	
							var required_html 	= 	(element_obj.required) ? '<span class="required '+field_obj.form_info.star_class+'" style="'+field_obj.form_info.star_style+'">*</span>' : ''; 
							var info			=	(element_obj.info) ? '<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all"  title="'+element_obj.info+'"><p><span class="ui-icon ui-icon-info"></span></p></div></div>' : '';		
							var file_type		= 	field_obj.form_info.attach_file_type;
							var file_type_arr	=	file_type.split(',');
							for(var f = 0; f < file_type_arr.length; f++)
							{
								file_type_arr[f] = '*.'+file_type_arr[f];
							}
							var file_format = file_type_arr.join(';');
							
								tab_content +='<div class="form-row">'+
												  '<div class="label '+field_obj.form_info.label_class+'" style="padding-left:5px;'+field_obj.form_info.label_style+'">'+element_obj.label+required_html+'</div>'+
												  '<div class="field">'+
															'<div style="float:left"><input type="file" name="'+element_obj.name+'_upload" id="'+element_obj.name+'_upload" /><input type="hidden" name="'+element_obj.name+'" id="'+element_obj.id+'" class="'+element_obj.id+'_class empty_class" value="" /></div>'+
															info+
															'<div class="input-errors" id="'+element_obj.name+'_err"></div>'+
													'</div>'+																																					
											'</div>'+
											'<div class="form-row">'+
												'<div class="label"></div>'+
												'<div class="field">'+
													'&nbsp;<span id="selected_file_'+element_obj.name+'"></span>'+
												'</div>'+
											'</div>';
									
									var setting_info = {};
									setting_info = field_obj.form_info;
									setting_info.table_name = 'forms';
									setting_info.primary_id_field = 'id';
									setting_info.primary_id_field_value = field_obj.form_info.id;
									setting_info.file_path_field 		= 'attach_file_path';
									setting_info.file_extension_field 	= 'attach_file_type';
									setting_info.file_max_size_field 	= 'attach_file_max_size';
									total_obj[tb] = { 'dynamicUpload' : { upload_field : element_obj.name+'_upload', upload_value_field : element_obj.name, setting_info: setting_info , language_array: languageArray(), save_url: "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'upload'), 'adminrout',    true) ?>", remove_url: "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'remove'), 'adminrout',    true) ?>" }, 'calendar' : ''};
									tb++;										
							break;
						case 'text':
							var element = element_obj.element; 
							var required_html 	= 	(element_obj.required) ? '<span class="required '+field_obj.form_info.star_class+'" style="'+field_obj.form_info.star_style+'">*</span>' : ''; 
							var info			=	(element_obj.info) ? '<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all"  title="'+element_obj.info+'"><p><span class="ui-icon ui-icon-info"></span></p></div></div>' : '';		
							var id_f 			=	element_obj.id;
							var id_arr			=	id_f.split('_');
							var name_arr		=	element_obj.name.split('_');
							if(jQuery.inArray("<?php echo Eicra_File_Constants::DATE; ?>", id_arr) > -1)
							{
								total_obj[tb] = { 'dynamicUpload' : '', 'calendar' : { 'id' : id_f }};
								tb++;
							}
							var sumbol = (jQuery.inArray("<?php echo Eicra_File_Constants::PRICE; ?>", name_arr) > -1) ? '&nbsp;<?php echo $currency->getSymbol(); ?>' : '';	
								tab_content +='<div class="form-row">'+
												'<div class="label '+field_obj.form_info.label_class+'" style="padding-left:5px;'+field_obj.form_info.label_style+'">'+element_obj.label+required_html+'</div>'+
												'<div class="field">'+											 	 
													element+sumbol+
													info+	
													'<div class="input-errors" id="'+element_obj.name+'_err"></div>'+													
												'</div>'+											
											'</div>';						
							break;
						case 'textarea':
							var element = element_obj.element; 
							var required_html 	= 	(element_obj.required) ? '<span class="required '+field_obj.form_info.star_class+'" style="'+field_obj.form_info.star_style+'">*</span>' : ''; 
							var info			=	(element_obj.info) ? '<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all"  title="'+element_obj.info+'"><p><span class="ui-icon ui-icon-info"></span></p></div></div>' : '';		
							
								tab_content +='<div class="form-row">'+
												'<div class="label '+field_obj.form_info.label_class+'" style="padding-left:5px;'+field_obj.form_info.label_style+'">'+element_obj.label+required_html+'</div>'+
												'<div class="field">'+											 	 
													element+
													info+	
													'<div class="input-errors" id="'+element_obj.name+'_err"></div>'+													
												'</div>'+											
											'</div>';						
							break;
						case 'multicheckbox':
							var element = element_obj.element; 
							var required_html 	= 	(element_obj.required) ? '<span class="required '+field_obj.form_info.star_class+'" style="'+field_obj.form_info.star_style+'">*</span>' : ''; 
							var info			=	(element_obj.info) ? '<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all"  title="'+element_obj.info+'"><p><span class="ui-icon ui-icon-info"></span></p></div></div>' : '';		
							
								tab_content +='<div class="form-row">'+
												'<div class="label '+field_obj.form_info.label_class+'" style="padding-left:5px;'+field_obj.form_info.label_style+'">'+element_obj.label+required_html+'</div>'+
												'<div class="field">'+											 	 
													'<div class="autos-features property-features vacationrental-features tours-features">'+element+'</div>'+
													info+	
													'<div class="input-errors" id="'+element_obj.name+'_err"></div>'+													
												'</div>'+
											'</div>';						
							break;
						case 'radio':
							var element = element_obj.element; 
							var required_html 	= 	(element_obj.required) ? '<span class="required '+field_obj.form_info.star_class+'" style="'+field_obj.form_info.star_style+'">*</span>' : ''; 
							var info			=	(element_obj.info) ? '<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all"  title="'+element_obj.info+'"><p><span class="ui-icon ui-icon-info"></span></p></div></div>' : '';		
							
								tab_content +='<div class="form-row">'+
												'<div class="label '+field_obj.form_info.label_class+'" style="padding-left:5px;'+field_obj.form_info.label_style+'">'+element_obj.label+required_html+'</div>'+
												'<div class="field">'+											 	 
													'<div class="property-features">'+element+'</div>'+
													info+	
													'<div class="input-errors" id="'+element_obj.name+'_err"></div>'+													
												'</div>'+
											'</div>';						
							break;
						default:
							var element = element_obj.element; 
							var required_html 	= 	(element_obj.required) ? '<span class="required '+field_obj.form_info.star_class+'" style="'+field_obj.form_info.star_style+'">*</span>' : ''; 
							var info			=	(element_obj.info) ? '<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all"  title="'+element_obj.info+'"><p><span class="ui-icon ui-icon-info"></span></p></div></div>' : '';		
							
								tab_content +='<div class="form-row">'+
												'<div class="label '+field_obj.form_info.label_class+'" style="padding-left:5px;'+field_obj.form_info.label_style+'">'+element_obj.label+required_html+'</div>'+
												'<div class="field">'+											 	 
													element+
													info+	
													'<div class="input-errors" id="'+element_obj.name+'_err"></div>'+													
												'</div>'+
											'</div>';
							break;
					}
				}
			}
			tab_content += 		'</div></fieldset>';
			addTab(tab_title, tab_content, tab_counter);	
			afterAddFunction(total_obj);	
			tab_counter++;			
		}
	}
}

function addTab(tab_title,tab_content,tab_counter)
{	
		$( "#tabs" ).append( "<div id='tabs-"+tab_counter+"'>" + tab_content + "</div>" );
		$( "<li><a href='<?php echo $tab_base_link; ?>#tabs-"+tab_counter+"' rel='tabs-"+tab_counter+"'>"+tab_title+"</a></li>" ).appendTo( "#tabs .ui-tabs-nav" );
		$( "#tabs" ).tabs( "refresh" );
			
}

function removeTabs()
{	
	$.each($( "#tabs" ).find( ".ui-tabs-nav li" ), function(i, element){
		
		if($(element).children('a:first').attr('rel') != null && $(element).children('a:first').attr('rel') != '')
		{
			var panelId = $(element).children('a:first').attr('rel');
			$(this).remove();
			$( "#" + panelId ).remove();
		}
		$( "#tabs" ).tabs( "refresh" );
	});
}

function afterAddFunction(total_obj)
{
	for(var tb = 0; tb < total_obj.length; tb++)
	{
		if(total_obj[tb]['dynamicUpload'])
		{
			dynamicUploader(total_obj[tb]['dynamicUpload']['upload_field'], total_obj[tb]['dynamicUpload']['upload_value_field'], total_obj[tb]['dynamicUpload']['setting_info'], total_obj[tb]['dynamicUpload']['language_array'], total_obj[tb]['dynamicUpload']['save_url'], total_obj[tb]['dynamicUpload']['remove_url'], true);
		}
		if(total_obj[tb]['calendar'])
		{
			calendar(total_obj[tb]['calendar']['id']);
		}
	}
	qToolTipFunctions();
	
	$('#toc a').unbind('click');
	$('#toc a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 1500, { easing:'swing' });
		$(this.hash).find('span.message').text( this.title );
		return false;
	});
	
	$('span.top-go a').unbind('click');
	$('span.top-go a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 1500, { easing:'swing' });		
		return false;
	});
}
/**********************************DYNAMIC FIELD GENERATOR END****************************************************/


/***********************************************************************UPLOAD FUNCTIONS START********************************************************/

function uploadSettingsStart(json_arr)
{
	uploadSettingsEnd();
		
	$('#property_image_block').prepend('<input type="file" name="property_image_upload" id="property_image_upload" />');	
	var thumb_setting_param = json_arr.param_fields;
	thumb_setting_param['file_path_field'] = 'file_path_property_image';	
	var thumb_setting_info = getSettingInfo(json_arr.group_info, thumb_setting_param);							
	dynamicUploader('property_image_upload', 'property_image', thumb_setting_info, languageArray(), "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'upload'), 'adminrout',    true) ?>", "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'remove'), 'adminrout',    true) ?>", true);
	
	$('#feature_floor_plan_image_block').prepend('<input type="file" name="feature_floor_plan_image_upload" id="feature_floor_plan_image_upload" />');	
	var file_setting_param = json_arr.param_fields;		
	thumb_setting_param['file_path_field'] = 'file_path_feature_floor_plan_image';	
	var file_setting_info = getSettingInfo(json_arr.group_info, file_setting_param);							
	dynamicUploader('feature_floor_plan_image_upload', 'feature_floor_plan_image', file_setting_info, languageArray(), "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'upload'), 'adminrout',    true) ?>", "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'remove'), 'adminrout',    true) ?>", true);
	
	$('#property_image_err').html("");
	$('#feature_floor_plan_image_err').html("");
}

function uploadSettingsEnd()
{	
	$('#property_image_upload').parents('div.k-upload').remove();	
	$('#feature_floor_plan_image_upload').parents('div.k-upload').remove();	
	$('#property_image_err').html("<?php echo $this->translator->translator("group_id_selected_err"); ?>");
	$('#feature_floor_plan_image_err').html("<?php echo $this->translator->translator("group_id_selected_err"); ?>");
}

function languageArray()
{
	var language_array = [];
	language_array['portfolio_upload_dy_text_select'] 					= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_dy_text_select", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_cancel'] 						= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_cancel", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_dropFilesHere'] 				= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_dropFilesHere", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_remove'] 						= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_remove", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_retry'] 						= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_retry", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_statusFailed'] 				= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_statusFailed", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_statusUploaded'] 				= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_statusUploaded", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_statusUploading'] 			= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_statusUploading", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_upload_text_uploadSelectedFiles'] 		= "<?php echo html_entity_decode($this->translator->translator("portfolio_upload_text_uploadSelectedFiles", '', 'Portfolio'), ENT_QUOTES, 'UTF-8'); ?>";
	language_array['portfolio_file_extension_dy_support'] 				= "<?php echo $this->translator->translator("portfolio_file_extension_dy_support", '', 'Portfolio'); ?>";
	language_array['portfolio_file_extension_dy_not_supportable_ext1'] 	= "<?php echo $this->translator->translator("portfolio_file_extension_dy_not_supportable_ext1", '', 'Portfolio'); ?>";
	language_array['portfolio_file_extension_dy_not_supportable_ext2']  = "<?php echo $this->translator->translator("portfolio_file_extension_dy_not_supportable_ext2", '', 'Portfolio'); ?>";
	language_array['portfolio_file_size_dy_support'] 					= "<?php echo $this->translator->translator("portfolio_file_size_dy_support", '', 'Portfolio'); ?>";
	language_array['portfolio_file_upload_err'] 						= "<?php echo $this->translator->translator("portfolio_file_upload_err", '', 'Portfolio'); ?>";
	return language_array;
}


function successFileDecoretion(fileObj, serverData, upload_field, upload_value_field)
{
		var extension = fileObj.extension;
		var ext = extension.replace('.','');	
		
		var img_path = '';
		switch(ext.toLowerCase())
		{
			case 'flv':
			case 'swf':
			case 'FLV':
			case 'SWF':
				img_path = '<?php echo $this->baseUrl(); ?>'+'/application/modules/Administrator/layouts/scripts/images/common/flash.png';
				break;
			case 'mp3':
			case 'MP3':
				img_path = '<?php echo $this->baseUrl(); ?>'+'/application/modules/Administrator/layouts/scripts/images/common/mp3.png';
				break;
			case 'avi':
			case 'wmv':
			case 'wma':
			case 'WMA':
			case 'AVI':
			case 'WMV':
				img_path = '<?php echo $this->baseUrl(); ?>'+'/application/modules/Administrator/layouts/scripts/images/common/avi_thumb.png';
				break;
			case 'pdf':
			case 'doc':
			case 'docx':
			case 'xls':
			case 'xlsx':
			case 'ppt':
			case 'pptx':
			case 'PDF':
			case 'DOC':
			case 'DOCX':
			case 'XLS':
			case 'XLSX':
			case 'PPT':
			case 'PPTX':
				img_path = '<?php echo $this->baseUrl(); ?>'+'/application/modules/Administrator/layouts/scripts/images/common/'+ext.toLowerCase()+'.png';
				break;
			default:
				if(isImage(fileObj))
				{				
					img_path = "<?php echo $this->baseUrl().'/'; ?>"+serverData.file_path+'/'+fileObj.name; 
				}
				else
				{	
					img_path = "<?php echo $this->baseUrl().'/'; ?>application/modules/Administrator/layouts/scripts/images/common/all_file_thumb.png";
				}	
				break;
		}		
		
		
		var img_code = '<span class="thumb"><img src="'+img_path+'" title="'+fileObj.name+'" width="20" height="10" /></span>';		 
		var down_link = (!isImage(fileObj)) ? '<br /><a href="'+serverData.file_path+'/'+fileObj.name+'"><?php echo $this->translator->translator("common_download", "", "Projects"); ?></a>' : '';
		
		var checked = '';
		var primary = '&nbsp;&nbsp;&nbsp;';	
		var block = 'selected_file_'+upload_value_field;
		var img_type = '';	
		var primary_file_field_radio = '';		
		switch(upload_value_field)
		{
			case 'property_image':	
					checked = ($('#'+upload_value_field).val() == '') ? ' checked="checked" ' : '';	
					primary_file_field_radio =	 'property_primary_image';						
					img_type = 	($('#'+upload_value_field).val() == '') ? "<span class='main'><?php echo $this->translator->translator('gallery_img_main', '', 'Gallery'); ?></span><br />" : "<span class='related'><?php echo $this->translator->translator('gallery_img_related', '', 'Gallery'); ?></span><br />";				
					primary = '<input class="radio_style" type="radio" name="'+primary_file_field_radio+'" id="'+primary_file_field_radio+'" '+checked+' value="'+fileObj.name+'" title="<?php echo $this->translator->translator("property_primary_image"); ?>" />';
				break;
			case 'feature_floor_plan_image':
					checked = ($('#'+upload_value_field).val() == '') ? ' checked="checked" ' : '';		
					primary_file_field_radio =	'feature_primary_floor_image';	
					img_type = 	($('#'+upload_value_field).val() == '') ? "<span class='main'><?php echo $this->translator->translator('gallery_img_main', '', 'Gallery'); ?></span><br />" : "<span class='related'><?php echo $this->translator->translator('gallery_img_related', '', 'Gallery'); ?></span><br />";		
					primary = '<input class="radio_style" type="radio" name="'+primary_file_field_radio+'" id="'+primary_file_field_radio+'" '+checked+' value="'+fileObj.name+'" title="<?php echo $this->translator->translator("property_primary_image"); ?>" />';
				break;
		}
		
		var del_link = '<a href="javascript:void(0)" class="delete_uploaded_image_link" field_name="'+upload_value_field+'" file_name="'+fileObj.name+'" file_path="'+serverData.file_path+'"><?php echo $this->translator->translator("common_delete_title"); ?></a>'+primary +  down_link;
		
		if(serverData.multi)
		{		
			$('#'+block).append('<div class="upload-img box">'+img_type+'<span>'+img_code+'<br /><br />&nbsp;'+del_link+'&nbsp;</span></div>');				 
			var file_val = ($('#'+upload_value_field).val() == '') ? fileObj.name :  $('#'+upload_value_field).val()+','+fileObj.name;	
		}
		else
		{
			$('#'+block).html('<div class="upload-img box">'+img_type+'<span>'+img_code+'<br /><br />&nbsp;'+del_link+'&nbsp;</span></div>');				 
			var file_val = fileObj.name;
		}
		$('#'+upload_value_field).val(file_val);
		deleteFiles("<?php echo $this->translator->translator('gallery_img_main', '', 'Gallery'); ?>", "<?php echo $this->translator->translator('gallery_img_related', '', 'Gallery'); ?>", "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action'     => 'remove' ), 'adminrout',    true) ?>", "<?php echo $this->translator->translator('common_delete_title'); ?>");	
		imageThumbnil();	
}

function onComplete(e) {
			
}

function onCancel(e) {
	
}

function onProgress(e) {
					
}

/***********************************************************************UPLOAD FUNCTIONS END********************************************************/



/********************************Category Tree Function*******************************************/
function categoryTreeGen()
{
	$(".example").treeTable({
	  initialState: "expanded"
	});
	
	// Drag & Drop Example Code
	$("#dnd-example .file, #dnd-example .folder").draggable({
	  helper: "clone",
	  opacity: .75,
	  refreshPositions: true,
	  revert: "invalid",
	  revertDuration: 300,
	  scroll: true
	});
	
	
	$("#dnd-example .folder").each(function() {
	  $($(this).parents("tr")[0]).droppable({
		accept: ".file, .folder",
		drop: function(e, ui) { 
		var fieldObj = {};
				fieldObj.id = $(ui.draggable).parents("tr")[0].id;
				fieldObj.to =	this.id;
			var url = "<?php echo $this->url( array('module' => 'Property','controller' => 'backend', 'action'     => 'parent' ), 'adminrout',    true) ?>";
		  $($(ui.draggable).parents("tr")[0]).postDataTo(this,fieldObj,url);
		  $($(ui.draggable).parents("tr")[0]).appendBranchTo(this);
		  
		  // Issue a POST call to send the new location (this) of the 
		  // node (ui.draggable) to the server.
		},
		hoverClass: "accept",
		over: function(e, ui) {
		  if(this.id != $(ui.draggable.parents("tr.parent")[0]).id && !$(this).is(".expanded")) {
			$(this).expand();
		  }
		}
	  });
	});
	
	 $("#dnd-example .file").each(function() {
	  $($(this).parents("tr")[0]).droppable({
		accept: ".file, .folder",
		drop: function(e, ui) {
			var fieldObj = {};
				fieldObj.id = $(ui.draggable).parents("tr")[0].id;
				fieldObj.to =	this.id;
			var url = "<?php echo $this->url( array('module' => 'Property','controller' => 'backend', 'action'     => 'parent' ), 'adminrout',    true) ?>";
		  $($(ui.draggable).parents("tr")[0]).postDataTo(this,fieldObj,url); 
		  $($(ui.draggable).parents("tr")[0]).appendBranchTo(this);
		  
		  // Issue a POST call to send the new location (this) of the 
		  // node (ui.draggable) to the server.
		},
		hoverClass: "accept",
		over: function(e, ui) {
		  if(this.id != $(ui.draggable.parents("tr.parent")[0]).id && !$(this).is(".expanded")) {
			$(this).expand();
		  }
		}
	  });
	});
	
	// Make visible that a row is clicked
	$("table#dnd-example tbody tr").mousedown(function() {
	  $("tr.selected").removeClass("selected"); // Deselect currently selected rows
	  $(this).addClass("selected");
	});
	
	// Make sure row is selected when span is clicked
	$("table#dnd-example tbody tr span").mousedown(function() {
		var node_id = $(this).parents("tr")[0].id.substr(5);
		var node_name = $(this).html()+' ('+node_id+')';
		$('#property_parent').val(node_id);
		$('#dataId').html(node_name);
	  $($(this).parents("tr")[0]).trigger("mousedown");
	});
}

/************************************************IMAGE THUMBNIL************************************************/
function imageThumbnil()
{	
	$("span.thumb").hover(function() {
		$(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
		$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
			.animate({
				marginTop: '-110px', /* The next 4 lines will vertically align this image */ 
				marginLeft: '-110px',
				top: '50%',
				left: '50%',
				width: '174px', /* Set new width */
				height: '174px', /* Set new height */
				padding: '20px'
			}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */
	
		} , function() {
		$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
		$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
			.animate({
				marginTop: '2px', /* Set alignment back to default */
				marginLeft: '0',
				top: '0',
				left: '0',
				width: '30px', /* Set width back to default */
				height: '20px', /* Set height back to default */
				padding: '5px'
			}, 400);
	});
}
function getFileExtension(filename)
{
	return filename.replace(/^.*?\.([a-zA-Z0-9]+)$/, "$1");
}


function is_image(filename)
{
	var ext = getFileExtension(filename);
	if(ext == 'jpg' || ext == 'JPG' || ext == 'png' || ext == 'PNG' || ext == 'bmp' || ext == 'BMP' || ext == 'gif' || ext == 'GIF')
	{
		return true;
	}
	else
	{
		return false;
	}
}

function calendar(id)
{
	$("#"+id).datepicker({
		showOn: 'button',
		buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
		buttonImageOnly: true,
		showAnim: 'slide',
		buttonText: 'Calender',
		dateFormat:'yy-mm-dd',
		autoSize:false,
		showButtonPanel:false,
		changeMonth: true,
		changeYear: true
	});
	 $("img[class='ui-datepicker-trigger']").each(function(){ 
			$(this).attr('style', '');
		 });
}

$(function() {
		$("#available_added_on").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'bounce',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("#availabe_from").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'slide',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("#available_to").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'blind',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("#available_expire_date").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'fadeIn',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("#available_activation_date").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'fold',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("#meter_electric_expire").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'bounce',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("#meter_gas_expire").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'clip',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("#meter_energy_expire").datepicker({
			showOn: 'button',
			buttonImage: 'application/modules/Administrator/layouts/scripts/images/common/calendar.png',
			buttonImageOnly: true,
			showAnim: 'drop',
			buttonText: 'Calender',
			dateFormat:'yy-mm-dd',
			autoSize:false,
			showButtonPanel:false,
			changeMonth: true,
			changeYear: true
		});
		$("img[class='ui-datepicker-trigger']").each(function(){ 
			$(this).attr('style', '');
		 });
	});
</script>

<div id="container">
<?php if (!$this->allow()) : ?>
	<div class="grid_12 t_a_bottom">
		<?php echo $this->translator->translator('Member_Access_deny_desc'); ?>
	</div>
<?php else : ?>
<div id="button_top_bar"></div>
<div class="title-container">
	<div class="property-add"><h1><?php echo $this->translator->translator('property_page_add_page_name'); ?></h1></div>
    
    <div class="button-container">
        <span class="button ui-widget-content-1"><a href="<?php echo $this->url( array('module' => 'Property','controller' => 'Backendpro', 'action'     => 'list' ,'group_id' => $param_group_id), 'adminrout',    true) ?>" class="back_btn_link"><span class="icon back"><?php echo $this->translator->translator('common_back'); ?></span></a></span>
        <span class="button ui-widget-content-1"><a href="javascript:  void(0);" class="reset_btn"><span class="icon reset"><?php echo $this->translator->translator('common_reset'); ?></span></a></span>
        <span class="button ui-widget-content-1"><a href="javascript: void(0);" class="add_property_btn"><span class="icon save"><?php echo $this->translator->translator('common_save'); ?></span></a></span>
    </div>
</div>

<div class="content-container" id="topGo">
	<div id="sidebar-inner">
    	<div id="nav">
    		<div class="nav-header"><div class="nav-title"><?php echo $this->translator->translator('property_tree'); ?></div></div>
    		<div id="categoryTree" class="nav-body treebody">
           		&nbsp;	
            </div>
       	</div>
    </div>
    
    <div id="content-inner">
    	<div id="actionMessage"></div>
        
        <form name="formCategory" id="formCategory" method="post">
        	<div id="generalInfo">
            	<div id="tabs">
                	<ul>
                        <li><a href="<?php echo $tab_base_link; ?>#tabs-1"><?php echo $this->translator->translator('property_general_info'); ?></a></li>
                        <li><a href="<?php echo $tab_base_link; ?>#tabs-2"><?php echo $this->translator->translator('property_page_page_image'); ?></a></li>
                        <li><a href="<?php echo $tab_base_link; ?>#tabs-3"><?php echo $this->translator->translator('property_page_feature'); ?></a></li>
                        <li><a href="<?php echo $tab_base_link; ?>#tabs-4"><?php echo $this->translator->translator('property_related_maids'); ?></a></li>
                        <!--<li><a href="<?php echo $tab_base_link; ?>#tabs-5"><?php echo $this->translator->translator('property_page_page_Other'); ?></a></li>-->
                    </ul>
                    
                    <div id="tabs-1">
                    	<fieldset class="fieldset">
                		<legend class="legend"><?php echo $this->translator->translator('property_page_page_info'); ?></legend>
                        <span class="top-go right-float"><a href="#topGo"><img src="application/modules/Administrator/layouts/scripts/images/tools/top.png" border="0" alt="<?php echo $this->translator->translator('common_go_top_title'); ?>" title="<?php echo $this->translator->translator('common_go_top_title'); ?>" /></a></span>
                        <span class="asterisk"><?php echo $this->translator->translator('common_asterisk_important'); ?></span>
                       	<div class="form">
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_name->getLabel();  if($this->proForm->property_name->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <span class="ui-widget"><?php  echo $this->proForm->property_name;  ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_name->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_name_err"></div>
                                </div>
                            </div>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_title->getLabel();  if($this->proForm->property_title->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <?php  echo $this->proForm->property_title;  ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_title->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_title_err"></div>
                                </div>
                            </div>
                            <?php
							if($auth->getIdentity()->allow_to_change_ownership == '1')
								{
							?>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_owner->getLabel();  if($this->proForm->property_owner->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <span class="ui-widget"><?php echo $this->proForm->property_owner;  ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_owner->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_owner_err"></div>
                                </div>
                            </div>
							
							<?php
								}
							?>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->group_id->getLabel();  if($this->proForm->group_id->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <div class="left-float"><?php echo $this->proForm->group_id; ?></div><span id="group_id_loader"></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->group_id->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="group_id_err"></div>
                                </div>
                            </div>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_type->getLabel();  if($this->proForm->property_type->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <?php echo $this->proForm->property_type; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_type->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_type_err"></div>
                                </div>
                            </div>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->category_id->getLabel(); if($this->proForm->category_id->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                  <span id="dataId"><p style="color:red;"><?php if($this->proForm->category_id->getAttrib('right_label')){ echo $this->escape($this->proForm->category_id->getAttrib('right_label')); } ?></p></span><?php echo $this->proForm->category_id; ?>
                                    <div class="input-errors" id="category_id_err"></div>  
                              </div>
                            </div>
                            
                            
                                
                                 <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_size->getLabel();  if($this->proForm->property_size->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <span class="ui-widget"><?php echo $this->proForm->property_size;  ?>&nbsp;<?php if($this->proForm->property_size->getAttrib('right_label')){ echo $this->escape($this->proForm->property_size->getAttrib('right_label')); } ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_size->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_size_err"></div>
                                </div>
                            </div>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_lot->getLabel();  if($this->proForm->property_lot->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <span class="ui-widget"><?php echo $this->proForm->property_lot;  ?>&nbsp;<?php if($this->proForm->property_size->getAttrib('right_label')){ echo $this->escape($this->proForm->property_lot->getAttrib('right_label')); } ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_lot->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_lot_err"></div>
                                </div>
                            </div>
                            
                           <!-- Feature Other Amenities to City of Work -->
                               <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_other_amenities->getLabel();  if($this->proForm->feature_other_amenities->isRequired()){ ?><span class="required">*</span><?php }?>
                                </div>
                                
                                <div class="field">
                                	<div class="property-features"><?php echo $this->proForm->feature_other_amenities; ?></div>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_other_amenities->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                  	<div class="input-errors" id="feature_other_amenities_err"></div>
                               	</div>
                              </div>
                           <!-- Feature Furnishing to Interest in working overseas -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_furnishing->getLabel();  if($this->proForm->feature_furnishing->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<?php  echo $this->proForm->feature_furnishing; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_furnishing->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_furnishing_err"></div>
                               	</div>
                          	</div>
                            
                         <!-- Post Code to Experience overseas -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->post_code->getLabel();  if($this->proForm->post_code->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                   	<span class="ui-widget"><?php echo $this->proForm->post_code; ?>&nbsp;<?php if($this->proForm->post_code->getAttrib('right_label')){ echo $this->escape($this->proForm->post_code->getAttrib('right_label')); } ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->post_code->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="post_code_err"></div>
                                </div>
                            </div>

                            <!-- Price to Salary -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_price->getLabel();  if($this->proForm->property_price->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<?php echo $this->proForm->property_price.'&nbsp;'.$currency->getSymbol(); ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_price->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_price_err"></div>
                               	</div>
                          	</div>
                           

                            <!-- Bathroom to Age -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_bathroom->getLabel();  if($this->proForm->feature_bathroom->isRequired()){ ?><span class="required">*</span><?php }?>
                                </div>
                                
                                <div class="field">
                                  <span><?php echo $this->proForm->feature_bathroom;  ?>&nbsp;<?php if($this->proForm->property_size->getAttrib('right_label')){ echo $this->escape($this->proForm->feature_bathroom->getAttrib('right_label')); } ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_bathroom->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_bathroom_err"></div>
                               	</div>
                          	</div>

                            

                            <!-- Glazing to Education -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_glazing->getLabel();  if($this->proForm->feature_glazing->isRequired()){ ?><?php } ?>
                                </div>
                    
                                <div class="field">
                                	<?php echo $this->proForm->feature_glazing;  ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_glazing->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                  	<div class="input-errors" id="feature_glazing_err"></div>
                                </div>
                         	</div>
                         <!-- Feature Room to Experience -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_room_no->getLabel();  if($this->proForm->feature_room_no->isRequired()){ ?><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<span class="ui-widget"><?php  echo $this->proForm->feature_room_no; ?>&nbsp;<?php if($this->proForm->feature_room_no->getAttrib('right_label')){ echo $this->escape($this->proForm->feature_room_no->getAttrib('right_label')); } ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_room_no->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_room_no_err"></div>
                               	</div>
                          	</div>
     
                            <!-- House Name to Status -->
                             <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->house_name->getLabel();  if($this->proForm->house_name->isRequired()){ ?><?php } ?>
                                </div>
                                
                                <div class="field">
                                   	<?php echo $this->proForm->house_name; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->house_name->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="house_name_err"></div>
                                </div>
                            </div>
                             <!-- Property code to Have a Child -->
                              <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_code->getLabel();  if($this->proForm->property_code->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <span class="ui-widget"><?php echo $this->proForm->property_code;  ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_code->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_code_err"></div>
                                </div>
                            </div>                            
                         
                            <!-- Property tipology to Religion -->
                             <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_tipology->getLabel();  if($this->proForm->property_tipology->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <span class="ui-widget"><?php echo $this->proForm->property_tipology;  ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_tipology->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_tipology_err"></div>
                                </div>
                            </div>

                            <!-- Dinning space to Ethnic Origin -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_dinning_space->getLabel();  if($this->proForm->feature_dinning_space->isRequired()){ ?><?php } ?>
                                </div>
                    
                                <div class="field">
                                	<?php  echo $this->proForm->feature_dinning_space;  ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_dinning_space->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                  	<div class="input-errors" id="feature_dinning_space_err"></div>
                                </div>
                         	</div>                    
                            <!-- Stars to Rate of Work Proficiency -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->stars->getLabel();  if($this->proForm->stars->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <span class="ui-widget"><?php echo $this->proForm->stars;  ?></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->stars->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="stars_err"></div>
                                </div>
                            </div>

                            
                           <!-- Reception to Speak English --> 
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_reception->getLabel();  if($this->proForm->feature_reception->isRequired()){ ?><span class="required">*</span><?php }?>
                                </div>
                                
                                <div class="field">
                                	<?php echo $this->proForm->feature_reception;  ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_reception->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_reception_err"></div>
                               	</div>
                          	</div>                    

                            <!-- Description to Write Your Resume -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_desc->getLabel();  if($this->proForm->property_desc->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                    
                                <div class="field">
                                    <div class="left-float"><?php echo $this->proForm->property_desc; ?></div>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_desc->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                  	<span id="loaderLink1"><a href="javascript:void(0);" onClick="loadTinyMCE('property_desc',1);"><img src="application/modules/Administrator/layouts/scripts/images/common/editors.gif" border="0" title="<?php echo $this->translator->translator('common_editor_open'); ?>" alt="<?php echo $this->translator->translator('common_editor_open'); ?>" /></a></span>
                                    <div class="input-errors" id="property_desc_err"></div>
                                </div>	
                            </div>
                       	</div>
                       	</fieldset>
                        
                        <fieldset class="fieldset last">
                		<legend class="legend"><?php echo $this->translator->translator('property_page_address_info'); ?></legend>
                        <span class="top-go right-float"><a href="#topGo"><img src="application/modules/Administrator/layouts/scripts/images/tools/top.png" border="0" alt="<?php echo $this->translator->translator('common_go_top_title'); ?>" title="<?php echo $this->translator->translator('common_go_top_title'); ?>" /></a></span>
                       	<div class="form">
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->country_id->getLabel();  if($this->proForm->country_id->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <?php echo $this->proForm->country_id; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->country_id->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="country_id_err"></div>
                                </div>
                            </div>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->state_id->getLabel();  if($this->proForm->state_id->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                    <div class="left-float"><?php echo $this->proForm->state_id; ?></div><span id="state_id_loader"></span>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->state_id->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="state_id_err"></div>
                                </div>
                            </div>
                            
                            <!-- Last Area ID -->
                              <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->house_location->getLabel();  if($this->proForm->house_location->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                   	<?php echo $this->proForm->house_location; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->house_location->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="house_location_err"></div>
                                </div>
                            </div>
                     	</div>
                        </fieldset>
                    </div>
                    
                    

                    <div id="tabs-2">
                    	<fieldset class="fieldset">
                		<legend class="legend"><?php echo $this->translator->translator('property_page_page_image'); ?></legend>
                        <span class="top-go right-float"><a href="#topGo"><img src="application/modules/Administrator/layouts/scripts/images/tools/top.png" border="0" alt="<?php echo $this->translator->translator('common_go_top_title'); ?>" title="<?php echo $this->translator->translator('common_go_top_title'); ?>" /></a></span>
                       	<div class="form">
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->property_image->getLabel();  if($this->proForm->property_image->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<?php	
										if($auth->getIdentity()->access_file_image_manager == '1')
										{
									?>
                                    <div class="upload-img">
                                      <span class="button ui-widget-content-1"><a href="javascript:  void(0);" class="upload_btn" rel="property_image"><span class="icon upload"><?php echo $this->translator->translator('common_upload'); ?></span></a></span>
                                      
                                  		<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_image->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    </div>
                                    <div>
                                      <br/><?php if($this->proForm->property_image->getAttrib('right_label')){ echo $this->escape($this->proForm->property_image->getAttrib('right_label')); } ?>
                                    </div>
                                    <?php echo $this->proForm->property_image; ?>
                                    <div class="input-errors" id="property_image_err"></div>
                                    
                                    <?php
										}
										else
										{
									?>
                                    <div class="upload-img">
                                    	<div id="property_image_block"><?php echo $this->proForm->property_image; ?></div>
									</div>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->property_image->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="property_image_err"><?php echo $this->translator->translator("group_id_selected_err"); ?></div>
                                    
                                    <?php
										}
									?>                          
                                </div>
                            </div>
                            
                            <div class="form-row">
                                <div class="label">
                                    &nbsp;
                                </div>
                    
                                <div class="field">
                                    <span id="selected_file_property_image"></span>
                                </div>
                            </div>
                            
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_floor_plan_image->getLabel();  if($this->proForm->feature_floor_plan_image->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
								<div class="field">
									<?php	
                                        if($auth->getIdentity()->access_file_image_manager == '1')
                                        {
                                    ?>
                                    
                                    <div class="upload-img">
                                        <span class="button ui-widget-content-1"><a href="javascript:  void(0);" class="upload_btn" rel="feature_floor_plan_image"><span class="icon upload"><?php echo $this->translator->translator('common_upload'); ?></span></a></span>
                                    	<div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_floor_plan_image->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    </div>
                                    
                                    <?php echo $this->proForm->feature_floor_plan_image; ?>
                                    <div class="input-errors" id="feature_floor_plan_image_err"></div>
                                    
                                    <?php
                                        }
                                        else
                                        {
                                    ?>
                                    <div class="upload-img">
                                   		 <div id="feature_floor_plan_image_block"><?php echo $this->proForm->feature_floor_plan_image; ?></div>
                                    </div>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_floor_plan_image->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_floor_plan_image_err"><?php echo $this->translator->translator("group_id_selected_err"); ?></div>
                                    <?php
										}
									?>
                                </div>
							</div>
							
							<div class="form-row">
                                <div class="label">
                                    &nbsp;
                                </div>
                    
                                <div class="field">
                                    <span id="selected_file_feature_floor_plan_image"></span>
                                </div>
                            </div>
                     	</div>
                        </fieldset>
                        
                        
                    </div>
                    
                    <div id="tabs-3">
                    	<fieldset class="fieldset">
                		<legend class="legend"><?php echo $this->translator->translator('property_page_sec_amenities'); ?></legend>
                        <span class="top-go right-float"><a href="#topGo"><img src="application/modules/Administrator/layouts/scripts/images/tools/top.png" border="0" alt="<?php echo $this->translator->translator('common_go_top_title'); ?>" title="<?php echo $this->translator->translator('common_go_top_title'); ?>" /></a></span>

                        <!-- Feature amenities to Skill -->
                       	<div class="form">
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_amenities->getLabel();  if($this->proForm->feature_amenities->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<div class="property-features"><?php  echo $this->proForm->feature_amenities; ?></div>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_amenities->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                  	<div class="input-errors" id="feature_amenities_err"></div>
                               	</div>
                          	</div>
                            
                            <div class="form-row">
                                <div class="label label-small">
                                    <hr />
                                </div>
                    		
                                <div class="field field-big">
                                	<hr />
                                </div>
                         	</div>

                            <!-- Feature Bedroom to Can Work Without Day Off -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_bedroom->getLabel();  if($this->proForm->feature_bedroom->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<?php  echo $this->proForm->feature_bedroom; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_bedroom->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_bedroom_err"></div>
                               	</div>
                          	</div>
                           <!-- Garage convert to Reference Letter from Employer Previous -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_garage->getLabel();  if($this->proForm->feature_garage->isRequired()){ ?><span class="required">*</span><?php }?>
                                </div>
                                
                                <div class="field">
                                	<?php echo $this->proForm->feature_garage; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_garage->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_garage_err"></div>
                               	</div>
                          	</div>                           
                                                                                   
                            <!-- Kitchen convert to Good Behavior Certificate from Police  -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_kitchen->getLabel();  if($this->proForm->feature_kitchen->isRequired()){ ?><span class="required">*</span><?php }?>
                                </div>
                                
                                <div class="field">
                                	<?php echo $this->proForm->feature_kitchen; ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_kitchen->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_kitchen_err"></div>
                               	</div>
                          	</div>
                              
                            <!-- Garden convert to Certificate of Regulated Health Doctor -->
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->feature_garden->getLabel();  if($this->proForm->feature_garden->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<?php  echo $this->proForm->feature_garden;  ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->feature_garden->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="feature_garden_err"></div>
                               	</div>
                          	</div>

                         
                     	</div>
                        </fieldset>                        
                     <!-- Create other fieldset right here -->
                    </div>
                    <!--Create Other Tabs down right here-->
                  <div id="tabs-4">                    
                        <fieldset class="fieldset">
                		<legend class="legend"><?php echo $this->translator->translator('property_product_page_related_items'); ?></legend>
                        <span class="top-go right-float"><a href="#topGo"><img src="application/modules/Administrator/layouts/scripts/images/tools/top.png" border="0" alt="<?php echo $this->translator->translator('common_go_top_title'); ?>" title="<?php echo $this->translator->translator('common_go_top_title'); ?>" /></a></span>
                       	<div class="form">
                            <div class="form-row">
                                <div class="label">
                                    <?php echo $this->proForm->related_items->getLabel();  if($this->proForm->related_items->isRequired()){ ?><span class="required">*</span><?php } ?>
                                </div>
                                
                                <div class="field">
                                	<?php  echo $this->proForm->related_items;  ?>
                                    <div class="ui-widget ui-helper-clearfix info"><div class="ui-widget-header ui-corner-all" title="<?php echo $this->escape($this->proForm->related_items->getAttrib('title')); ?>"><p><span class="ui-icon ui-icon-info"></span></p></div></div>
                                    <div class="input-errors" id="related_items_err"></div>
                               	</div>
                          	</div>
                     	</div>
                        </fieldset>	
                  </div>
                </div>
          	</div>
     	</form>
 	</div>
    
    <div class="button-container">
        <span class="button ui-widget-content-1"><a href="<?php echo $this->url( array('module' => 'Property','controller' => 'Backendpro', 'action'     => 'list' ,'group_id' => $param_group_id), 'adminrout',    true) ?>" class="back_btn_link"><span class="icon back"><?php echo $this->translator->translator('common_back'); ?></span></a></span>
        <span class="button ui-widget-content-1"><a href="javascript:  void(0);" class="reset_btn"><span class="icon reset"><?php echo $this->translator->translator('common_reset'); ?></span></a></span>
        <span class="button ui-widget-content-1"><a href="javascript: void(0);" class="add_property_btn"><span class="icon save"><?php echo $this->translator->translator('common_save'); ?></span></a></span>
    </div>
</div>

<div id="floatingbar">
	<h1><?php echo $this->translator->translator('property_page_add_page_name'); ?></h1>
    
    <div class="button-container">
        <span class="button ui-widget-content-1"><a href="<?php echo $this->url( array('module' => 'Property','controller' => 'Backendpro', 'action'     => 'list' ,'group_id' => $param_group_id), 'adminrout',    true) ?>" class="back_btn_link"><span class="icon back"><?php echo $this->translator->translator('common_back'); ?></span></a></span>
        <span class="button ui-widget-content-1"><a href="javascript:  void(0);" class="reset_btn"><span class="icon reset"><?php echo $this->translator->translator('common_reset'); ?></span></a></span>
        <span class="button ui-widget-content-1"><a href="javascript: void(0);" class="add_property_btn"><span class="icon save"><?php echo $this->translator->translator('common_save'); ?></span></a></span>
    </div>
</div>
<?php endif; ?>	
<div id="dialog_msg" title="<?php echo $this->translator->translator('common_dialog_msg',$this->translator->translator('property_page_add_page_name')); ?>">
</div>
<div id="dialog_container" style="display:none" title="<?php echo $this->translator->translator('common_processing_language'); ?>">
	<div id="progressbar" ></div>	
</div>

<div id="upload-form" title="<?php echo $this->translator->translator('property_page_page_dialog'); ?>">
	<div>
    	<form id="popupForm" target="i-upload-form" method="post" action="" >
            <input type="hidden" name="table_name" value="property_group"/>
            <input type="hidden" name="primary_id_field" value="id"/>
            <input type="hidden" name="primary_id_field_value" value=""/>   
            <input type="hidden" name="primary_file_field" value=""/> 
           	<input type="hidden" name="file_content"  value=""/>       
            <input type="hidden" name="file_path_field" value=""/>
            <input type="hidden" name="file_extension_field" value="file_type"/>
            <input type="hidden" name="file_max_size_field" value="file_size_max"/>
    	</form>
    	<iframe id="i-upload-form" name="i-upload-form" src="" class="iframe-img-upload"></iframe>       
    </div>
    <div class="button-container">
        <span class="button ui-widget-content-1"><a href="javascript:void(0);" class="select_file_btn"><span class="icon insert"><?php echo $this->translator->translator('property_page_page_insert'); ?></span></a></span>
        <span class="button ui-widget-content-1"><a href="javascript:void(0);" class="close_dialog_btn"><span class="icon close"><?php echo $this->translator->translator('common_close'); ?></span></a></span>
    </div> 
</div>
</div>